import { InjectionKey } from 'vue';
import { createStore, useStore as baseUseStore, Store } from 'vuex';
import user from './modules/user';

export interface RootStateTypes {
  [key: string]: any
}

export default createStore({
  modules: {
    user,
  }
});

export const key: InjectionKey<Store<RootStateTypes>> = Symbol();

// 定义自己的 `useStore` 组合式函数

const useStore = (): Store<RootStateTypes> => {
  return baseUseStore(key);
};

export {
  useStore
};